Unique Attributes v.1.0
Author: Ed Medvid
Date: 10/13/2004
by Kiril Nedelchev <kikoleppard@hotmail.bg>
August, 1 , 2005 - MODIFIED for Attribute Suite v.1.2.3
- added compatibility with Option Type Feature v.1.7.1. - comments and links for all option types in catalog/product_info.php
- added compatibility with Attribute Sorter - Sort Order for Product Options and Option Values and theirs displaying in catalog/product_info.php
view catalog/product_info.php
**********************************************************************
Change Log --->
10/16/2004 - First Release
**********************************************************************
Overview --->
Unique Attributes v1.0 provides the following:
- A unique name for attributes in admin, distinct from the display name
displayed in the catalog.
- A link (or comment) for each unique attribute. Links will pop up a small
window to provide a more detailed description of the option.
**********************************************************************
Use --->
Three screens replace the Product Attributes screen under Admin->Catalog
1) Product Options is essentially the upper left table from the original
Product Attributes screen with additional information and functionality
2) Option Values is essentially the upper right table from the original
Product Attributes screen with additional information and functionality
3) Attribute Manager is a slightly modified version of the New Attribute
Manager v4b contribution from Mike G. (all credit to him for this great
contrib)
Attributes are now assigned by creating options in Product Options, adding
values to the options in Option Values, and assigning these attributes
to products in Attribute Manager.
Unique Names, Option Comments, and Option Links are entered on the
Product Options screen. The unique name is necessary when you have 2
options with the same display name, like "Color" for shirts and "Color"
for jeans. Shirt colors might need a comment about the available
choices while jeans colors might need a comment or link about the
variation of colors in the materials.
All 3 fields can be left null. When:
Comment is entered (no link):
The comment is displayed to the right of the option in the catalog.
Comment and link are entered:
The comment is the link text and is displayed to the right of the
option in the catalog.
Link is entered (no comment):
"(Click for Details)" is the link text and is displayed to the right of the
option in the catalog.
For version 1.0, the link file name is entered as text and the store owner must
upload a file of the same name to: catalog/details/
**********************************************************************
Compatability --->
Unique Attributes v1.0 was developed for osCommerce 2.2M2
**********************************************************************
Installation--->
1) **** BACK UP YOUR CATALOG AND DATABASE! ****
***************************
2) In admin/new_attributes_include.php
Find -
while ($line = mysql_fetch_array($result, MYSQL_ASSOC)) {
$current_product_option_name = $line['products_options_name'];
Add after -
// unique attributes
$current_product_option_unique_name = $line['products_options_unique_name'];
// unique attributes
Find -
echo "<TD class=\"dataTableHeadingContent\"><B>" . $current_product_option_name . "</B></TD>";
Replace with -
// unique attributes
if ( $current_product_option_unique_name == "" ) {
echo "<TD class=\"dataTableHeadingContent\"><B>" . $current_product_option_name . "</B></TD>";
} else {
echo "<TD class=\"dataTableHeadingContent\"><B>" . $current_product_option_name . " / " . $current_product_option_unique_name . "</B></TD>";
}
// unique attributes
***************************
3) Create the following folder:
catalog\details\
***************************
4) Add the following new files:
In admin/
product_options.php - updates for Option Type Feature and Attribute Sorter
option_values.php - updates for and Attribute Sorter
In admin/includes/languages/english/
option_values.php
product_options.php - updates for Option Type Feature
***************************
5) In admin/includes/languages/english.php:
Find -
define('BOX_CATALOG_CATEGORIES_PRODUCTS_ATTRIBUTES', 'Products Attributes');
Add after -
// unique attributes
define('BOX_CATALOG_CATEGORIES_PRODUCT_OPTIONS', 'Product Options');
define('BOX_CATALOG_CATEGORIES_OPTION_VALUES', 'Option Values');
// unique attributes
***************************
6) In admin/includes/filenames.php:
Find -
define('FILENAME_CATEGORIES', 'categories.php');
Add after -
// unique attributes
define('FILENAME_PRODUCT_OPTIONS', 'product_options.php');
define('FILENAME_OPTION_VALUES', 'option_values.php');
// unique attributes
***************************
7) In admin/includes/boxes/catalog.php:
Find -
'<a href="' . tep_href_link('new_attributes.php', '', 'NONSSL') . '" class="menuBoxContentLink">*Attribute Manager</a><br>' .
Add before -
// unique attributes
'<a href="' . tep_href_link(FILENAME_PRODUCT_OPTIONS, '', 'NONSSL') . '" class="menuBoxContentLink">' . BOX_CATALOG_CATEGORIES_PRODUCT_OPTIONS . '</a><br>' .
'<a href="' . tep_href_link(FILENAME_OPTION_VALUES, '', 'NONSSL') . '" class="menuBoxContentLink">' . BOX_CATALOG_CATEGORIES_OPTION_VALUES . '</a><br>' .
// unique attributes
Find -
'<a href="' . tep_href_link(FILENAME_PRODUCTS_ATTRIBUTES, '', 'NONSSL') . '" class="menuBoxContentLink">' . BOX_CATALOG_CATEGORIES_PRODUCTS_ATTRIBUTES . '</a><br>' .
Delete or comment that line out.
***************************
8) In admin/includes/functions/general.php:
Find -
function tep_options_name($options_id) {
global $languages_id;
$options = tep_db_query("select products_options_name from " . TABLE_PRODUCTS_OPTIONS . " where products_options_id = '" . (int)$options_id . "' and language_id = '" . (int)$languages_id . "'");
$options_values = tep_db_fetch_array($options);
return $options_values['products_options_name'];
}
Add after -
// unique attributes
function tep_options_unique_name($options_id) {
global $languages_id;
$options = tep_db_query("select products_options_unique_name from " . TABLE_PRODUCTS_OPTIONS . " where products_options_id = '" . (int)$options_id . "' and language_id = '" . (int)$languages_id . "'");
$options_values = tep_db_fetch_array($options);
return $options_values['products_options_unique_name'];
}
// unique attributes
***************************
9) In catalog/product_info.php:
Find -
function popupWindow(url) {
window.open(url,'popupWindow','toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=no,resizable=yes,copyhistory=no,width=100,height=100,screenX=150,screenY=150,top=150,left=150')
}
Add after -
// Unique attributes
function popupDetailsWindow(url) {
window.open(url,'popupWindow','toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=yes,resizable=yes,copyhistory=no,width=450,height=450,screenX=150,screenY=150,top=150,left=150')
}
// Unique attributes
Find -
$products_options_name_query = tep_db_query("select distinct popt.products_options_id, popt.products_options_name from " . TABLE_PRODUCTS_OPTIONS . " popt, " . TABLE_PRODUCTS_ATTRIBUTES . " patrib where patrib.products_id='" . (int)$HTTP_GET_VARS['products_id'] . "' and patrib.options_id = popt.products_options_id and popt.language_id = '" . (int)$languages_id . "' order by popt.products_options_name");
Replace with -
// Unique attributes
$products_options_name_query = tep_db_query("select distinct popt.products_options_id, popt.products_options_name, popt.products_options_comment, popt.products_options_link from " . TABLE_PRODUCTS_OPTIONS . " popt, " . TABLE_PRODUCTS_ATTRIBUTES . " patrib where patrib.products_id='" . (int)$HTTP_GET_VARS['products_id'] . "' and patrib.options_id = popt.products_options_id and popt.language_id = '" . (int)$languages_id . "' order by popt.products_options_name");
// Unique attributes
Find -
<tr>
<td class="main"><?php echo $products_options_name['products_options_name'] . ':'; ?></td>
<td class="main"><?php echo tep_draw_pull_down_menu('id[' . $products_options_name['products_options_id'] . ']', $products_options_array, $selected_attribute); ?></td>
</tr>
Replace with -
<!-- unique attributes -->
<tr>
<td class="main"><?php echo $products_options_name['products_options_name'] . ':'; ?></td>
<td class="main"><?php echo tep_draw_pull_down_menu('id[' . $products_options_name['products_options_id'] . ']', $products_options_array, $selected_attribute); ?>
<?php
if ( $products_options_name['products_options_link'] != "" ) {
$link = DIR_WS_DETAILS . $products_options_name['products_options_link'];
if ( $products_options_name['products_options_comment'] != "" ) {
echo ' <a href="javascript:popupDetailsWindow(\'' . tep_href_link($link) . '\')">' . $products_options_name['products_options_comment'] . '</a>';
} else {
echo ' <a href="javascript:popupDetailsWindow(\'' . tep_href_link($link) . '\')">' . TEXT_DEFAULT_OPTION_LINK_TEXT . '</a>';
}
} else {
if ( $products_options_name['products_options_comment'] != "" ) {
echo " " . $products_options_name['products_options_comment'];
}
}
?>
</td>
<!-- unique attributes -->
***************************
10) In catalog/includes/languages/english/product_info.php:
Add -
define('TEXT_DEFAULT_OPTION_LINK_TEXT', '(Click for details)');
***************************
11) In catalog/includes/configure.php:
Find -
define('DIR_WS_IMAGES', 'images/');
Add after -
define('DIR_WS_DETAILS', 'details/');
That's It!
Go to Step b.1.5 - Attribute Sorter and Copier v.6